package com.Iron.Config;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

public class JedisConnectFactory {

//    private static JedisPool jedisPool = new JedisPool();

/*    static {
        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
        jedisPoolConfig.setMaxTotal(8);
        jedisPoolConfig.setMaxIdle(8);
        jedisPoolConfig.setMinIdle(0);
        JedisPool pool = new JedisPool(jedisPoolConfig, "127.0.0.1", 6379, 1000);
        System.out.println(pool.getResource().toString());
    }*/

    public static Jedis getJedis(){
        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
        jedisPoolConfig.setMaxTotal(8);
        jedisPoolConfig.setMaxIdle(8);
        jedisPoolConfig.setMinIdle(0);
        JedisPool pool = new JedisPool(jedisPoolConfig, "127.0.0.1", 6379, 1000);
        return pool.getResource();
    }
}
